/*
 * can_msg.h
 *
 * Created: 11.12.2013 17:19:43
 *  Author: User
 */ 


#ifndef CAN_MSG_H_
#define CAN_MSG_H_

typedef struct 
{
	uint8_t empty_bits1:2;
	uint8_t block_num:2;
	uint8_t block_type:3;
	uint8_t message_type:4;
	uint8_t empty_bits2:5;
	
}ID;

typedef union
{
	ID id;
	uint8_t bid[2];
	uint16_t iid;
	
}CAN_ID;






typedef struct  
{
	CAN_ID msg_id;
	uint16_t msg_ext_id;
	uint8_t msg_len;
	uint8_t msg_data[8];
}CAN_MSG;



#define MSG_CMD 0
#define MSG_ALARM 1
#define MSG_FAULT 2
#define MSG_REQ_COMPL 3
#define MSG_RES_ALARM 4
#define MSG_RES_FAULT 5
#define MSG_GEN_STATUS 6
#define MSG_SYS_RESET 7


#define SH_CANCEL 0
#define DL_APPEND 1
#define MODE_MANUAL 2
#define MODE_AUTO 3
#define RES_ADDR  4
#define RES_LINE 5
#define SH_PDU 6
#define SH_BP 7
#define SH_BIRS  8
#define ID_KEY  9
#define SH_AUTO 10
#define CMP_ENGINE  11
#define SH_PREP  12
#define SH_COMPL  13
#define ALRM_ADDR 14
#define ALRM_LINE 15
#define REQ_DOOR   16
#define ST_DOOR 17
#define TO_DOOR  18
#define NET_ERROR 19
#define E_NET_ERROR 20
#define PDU_FAULT 21
#define FAULT_ADDR  22
#define FAULT_LINE 23
#define FAULT_GEN  24
#define FAULT_TEL 25
#define FAULT_OV 26
#define FAULT_LIGHT 27
#define FAULT_SOUND  28
#define LINK_ADDR  29
#define ON_24V 30
#define BDIO_STATUS 31
#define RES_ZONE 32
#define FAULT_ADDR_DEV 33
#define COUNT_DOWN_TIME 34


#define BIRS 0
#define BP 1
#define BCPU 2
#define BCP 3
#define BU 4
#define BDVV 5
#define BRP 6
#define BKS 7

#define BREAK 0
#define SHUNT 1

#define EXTR_POW 0//1?????
#define LO_BATT 1
#define SH_BATT 2
#define NO_BATT 3
#define SH_LOAD_12 4
#define SH_LOAD_24 5





#endif /* CAN_MSG_H_ */